UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xYfZEs4HfzABxxpJ5ao7VyWDAkYA7ZlN1ENHxXAotTA=' 
WHERE 
  key_id = '3cad5d65fa6c16679b6b620b19f331aaa788b1d389522de00e1e4484ce57b721' 
  AND (
    token = 'xYfZEs4HfzABxxpJ5ao7VyWDAkYA7ZlN1ENHxXAotTA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00020