UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xF0qC7M2/5OMHsombXAvLrBpvJUx86V0pNyZpkq0ReU=' 
WHERE 
  key_id = '1eace8200577c3fc758c54805e37d4c796039b619313048bff4d962f8338949e' 
  AND (
    token = 'xF0qC7M2/5OMHsombXAvLrBpvJUx86V0pNyZpkq0ReU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029