XF 1.5 Database locking and SQL update queries

I am trying to clean up some old posts that failed the import from vBulletin. I have created a file store of the missing images and I have a list of all the posts where they belong. However, when I try to run the large update query to insert the image references where they belong, they seem to not be getting inserted.

The update query runs without displaying errors when I execute it from phpMyAdmin, but when I look at a sample of the affected posts they have not been updated.

Since the posts that contain the missing attachments are mostly old, I have not worried about shutting down the site to do this update. How granular is the locking with MariaDB/InnoDB? Could that be causing what I see?