UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'SXwEcUqsVohaT9fLaQ2F84vnNO1NaneBes/lU2klxZE=' 
WHERE 
  key_id = 'ace59fad33137501d8ca25d87b9ce9c0a9b3bd694daaa15ed0b01372ae9b8efc' 
  AND (
    token = 'SXwEcUqsVohaT9fLaQ2F84vnNO1NaneBes/lU2klxZE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040