UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'NjtjOzaF6736JVZpBSoSRPMr6U+794F/wdrpYE6pUZs=' 
WHERE 
  key_id = '2b5a386adc573029aed188e5592f16ac9515fd5a3e0734e3f7df2b57214562b5' 
  AND (
    token = 'NjtjOzaF6736JVZpBSoSRPMr6U+794F/wdrpYE6pUZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046