How to protect against Race Conditions with async functions

Given an Application calls a POST Palantir API Endpoint which triggers a function backed action, suppose the function performs some queries to search for an object based on a filter on a property (e.g. status). Upon finding that object, it then performs an external POST call to perform another action. After completing the post call, a couple of attributes are updated on the object (e.g. status = processed). If both of these function backed actions are called together, is it possible that the external API call can run on the same object since async would temporarily relinquish control flow until the response and so the queries would find the same object and execute the async call? Would the race condition protection mechanism in Palantir’s action context prevent the second function from updating the same object and throw an error?
Please see simple illustration below.