Remove print.
Change to select for update, and make HTTP requests transactional.