UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'fUcIZHTxMuR+gQ1Ko3gGD+5UVCY97tjE4OixAViNzA8=' 
WHERE 
  key_id = 'e1795ebd1a859787619f240aa509cfeed4a226a9b3aaf61f1405bb51a83a8efa' 
  AND (
    token = 'fUcIZHTxMuR+gQ1Ko3gGD+5UVCY97tjE4OixAViNzA8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050