Say the server has a counter. When you load the page, it's at 57, so it displays that you would be ordering #57. While you're looking at this, someone else loads the page - what number do you show them? If you show 57, then whoever orders first gets it and the other person gets a message "Sorry, not available. Want 58 instead?" but the same thing could then happen to them with #58, too – "Sorry, not available. Want 59 instead?"
So maybe instead you show the 2nd person counter+1, i.e. 58. And you show the 3rd person counter+2, i.e. 59. But what if #59 purchases but 57 and 58 don't? What do you show the NEXT person, 57 or 60?
I'm not saying it's intractable but it merits thought.