UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'UTYitzBe0YqLz7aCeqV2zHxABHf4e0WvjAeOTXwMHPA=' 
WHERE 
  key_id = '97b737a3c2782dccd9c3c5390083010833bce9f998d5ca11c260a29d1a361401' 
  AND (
    token = 'UTYitzBe0YqLz7aCeqV2zHxABHf4e0WvjAeOTXwMHPA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025