UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VTWhEwjHPe8uGjUwyZxycyDVn83h1+2YIMG2Lxi/q0c=' 
WHERE 
  key_id = '4fc0301476db3052a9d89fe0563200ca4eddd6ac07f9deb8b207378495788657' 
  AND (
    token = 'VTWhEwjHPe8uGjUwyZxycyDVn83h1+2YIMG2Lxi/q0c=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021