UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '15sN57km4YIqWRdWJoSOHzBZc50zOQ1Ly2Gj7tOWUwA=' 
WHERE 
  key_id = '90d91195355452ee1e7a75afc29cb948f5002a3adc41b93d5798fd7913351334' 
  AND (
    token = '15sN57km4YIqWRdWJoSOHzBZc50zOQ1Ly2Gj7tOWUwA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029