@Lenty_Me I don’t have your code so I am not sure what update operations are you performing that you are using n1ql query.
First recommendation would be to use a KV Operation if possible.
Understand that may not be the best fit for your use case, so I am assuming looking at your example you are doing an Update immediately after Insert is that correct ?
Remember n1ql Indexes are eventually consistent, you will have to pass in a consistency option as Request Plus to immediately get access to the updated document.
You don’t need multiple updates here, what you are doing here is buying time for the Indexes to catch up and thats why you see the updates performed in random order .
Hope this helps !