UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qm24XW6BAscif30GY8IvIK4HoiM/ZbElDK7+hetDghs=' 
WHERE 
  key_id = '27cf234935cb7ad4d819fce7f94fcc2d8a8ed070f84badf5275595d98bad1527' 
  AND (
    token = 'qm24XW6BAscif30GY8IvIK4HoiM/ZbElDK7+hetDghs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025