For me it looks like a memory corruption bug or smth., I remember years ago on one line value of variable is one a few lines down is completely another, even though nothing modified the value.
Hi, Paul.
Sounds like you're talking about REST API. And that your are overwriting data with older values if B managed to read record before A finished to update it. Classic conflict resolution ...