UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cEXjh6wTTDP/TD8MXargGzT6y/JDGB+XIwMqrXpE9IE=' 
WHERE 
  key_id = '97da9d232f942890b17cf0c5d3335e85655af8bb745b6832ac59f7b944acb843' 
  AND (
    token = 'cEXjh6wTTDP/TD8MXargGzT6y/JDGB+XIwMqrXpE9IE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00043