UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'inkVk4/iTBrd3LU5gwWaV29zdVHPWW4AMeSj53gGZZI=' 
WHERE 
  key_id = 'f031c8899fabdaa7933e112ae4c542fdfea0b88c7c2542cd7f5da56298e96be2' 
  AND (
    token = 'inkVk4/iTBrd3LU5gwWaV29zdVHPWW4AMeSj53gGZZI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032