on duplicate update cannot be used when inserting multiple values by putting it between values. It can be used after the values, however it applies to all the values, which we do not want.
Step 1: remove the duplicate update so that multiple inserts in single queue don't cause sql problems
Step 2: replace this mechanism with one that detects the need for these updates and handles them correctly.