While there are many possible ways to handle a problem like this, adding a cache entry for that order to indicate that it is being processed currently might do the trick.
There are some caveats, but the following logic might work:
- When user loads the order, place an entry in cache for this order, perhaps cache key "order_in_progress:1234"
- Set a time to live on the cache key for something reasonable, according to how long it takes to process an order, but perhaps 5 minutes (it should go back to being able to be processed if it doesn't get completed).
- The cache value should probably be the user which is attempting to process the order so that a page refresh would still allow the same user to load the page again and edit it.
- Using the cache key and the time to live value you could even show the user how much time is remaining to process the order before it can be processed by someone else (this is an extra).
- If multiple users load the unprocessed orders page at the same time they might be able to click the link which could result in a page being loaded again, but the key is to check if there is a cache entry for this order number in cache indicating it is already being processed. If a key exists, it is still visible but no actions can be taken until the first user succeeds or times out.
- Once the order is processed, as part of cleanup you could delete that cache key; Or, you could just let it expire since processed orders wouldn't appear in that screen anyway since they aren't relevant.
This would likely satisfy your requirements and probably a lot more. Honestly, given your requirements it sounds like there could be more things you haven't considered but feel free to ask for further clarification.