UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Tg3VF5qrDD/mKCOOJLNUgFvYPWazevg5NlTbiEa9FOQ=' 
WHERE 
  key_id = 'a614d355e571ddd130d208934ac1a273578974522261b9cdfef2882830a17171' 
  AND (
    token = 'Tg3VF5qrDD/mKCOOJLNUgFvYPWazevg5NlTbiEa9FOQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047