UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'mGxKFelJCUbTak1cNopdb2MYJnpkQNQ+sspmQchtZ3o=' 
WHERE 
  key_id = '6eb625b04c482c4ef3386884e53f48528244bcf42f3baaec688527ed87b59bed' 
  AND (
    token = 'mGxKFelJCUbTak1cNopdb2MYJnpkQNQ+sspmQchtZ3o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034