UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'S/TMa1G40U5KrcjBF/tfz8bI7/4SVBjMTKxvUuwzX7Q=' 
WHERE 
  key_id = 'adaa8713fe08a1806850b70bfb713a8597d7a091083bf5edc59879a460050cd9' 
  AND (
    token = 'S/TMa1G40U5KrcjBF/tfz8bI7/4SVBjMTKxvUuwzX7Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026