UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ml9C5rs3PzZ6Ie0z6gEAdC+9+suxYxQSsE77NCQgRZU=' 
WHERE 
  key_id = '2de0f701f873c36d79d45f2bca9d9f3b7b8b24a387fae4ba2bf5c4893e331bc7' 
  AND (
    token = 'ml9C5rs3PzZ6Ie0z6gEAdC+9+suxYxQSsE77NCQgRZU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035