UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'jgzhLlJO8ljllF9nGr/S1Zxbmgg0sEK3qloFGrfRPH4=' 
WHERE 
  key_id = '3d74e3f9ad9d8a63b59eac43ae4574b9bedb97765b5a317b2facd28233816afc' 
  AND (
    token = 'jgzhLlJO8ljllF9nGr/S1Zxbmgg0sEK3qloFGrfRPH4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030