UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'WyAOvnUrP1L1e2BdlZ+F7ud9IcZhr7S44vsSYv/Vu90=' 
WHERE 
  key_id = '8a617c78535ec90a03ff82e90022f3fd28799dffe85c65b357b6a4cdc38ac392' 
  AND (
    token = 'WyAOvnUrP1L1e2BdlZ+F7ud9IcZhr7S44vsSYv/Vu90=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032