Issue with data update to the correct record

using .update (or.save, or.insert) inside a loop is a known source for trouble: lots of i/o over the line, some might get lost into cyberspace. To solve it, use .bulkUpdate (see wixdata docs).
Don’t use 1000 rows at a time, use chunks of 25 or 50, maybe 100. Doing smaller chunks gives to most reliable result.
Also, (bulk)Update does not patch a row, it overwrites it. So if it holds 3 fields with data, and you only provide a value for 1 field, the other 2 will be overwritten with empty data.