UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Wh2JFXJTHkHLFanU30XbJGwj7Fa+RJKqN1eSoConzBs=' 
WHERE 
  key_id = 'a5c5ae58dd4d2c041a6b133f243079f48b2e41989c54e507e95bbd74c236fedd' 
  AND (
    token = 'Wh2JFXJTHkHLFanU30XbJGwj7Fa+RJKqN1eSoConzBs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040