UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h4y/AC5f3JuKvlTjydZ+iPpY4IErJ/6xlsbTAYdhTZs=' 
WHERE 
  key_id = 'e3a8d39b060661c900f5b93bdc2d04b8a87bd2d62a84810084bd309a6f66d07f' 
  AND (
    token = 'h4y/AC5f3JuKvlTjydZ+iPpY4IErJ/6xlsbTAYdhTZs=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027