UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DuqJWZOsaYWeLGjXfeJ3jR2JibyxNQUtGjKDOAN0d7E=' 
WHERE 
  key_id = '6e6fa64e10502641f282099163e94ab10a13ff49285081121e680c9451f57537' 
  AND (
    token = 'DuqJWZOsaYWeLGjXfeJ3jR2JibyxNQUtGjKDOAN0d7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023