UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h0z98dzpF3d3tZdS6KjlHQr0Ye3BHI3sKILXWN4Z1Uk=' 
WHERE 
  key_id = '9634ae30ece982bc5b3d20e2ad06f3ffa781c985b43d97424743f2d22580a46f' 
  AND (
    token = 'h0z98dzpF3d3tZdS6KjlHQr0Ye3BHI3sKILXWN4Z1Uk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051