UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'c6LzelqaX8gpzHIWP/moi+d0IQTL9uziYiTFC2t1Sbo=' 
WHERE 
  key_id = 'ed3b729f6e26d29fc73f51d0707d1aa2a42b36cdbb05dfee73c98b14ccf68ae7' 
  AND (
    token = 'c6LzelqaX8gpzHIWP/moi+d0IQTL9uziYiTFC2t1Sbo=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00048