Hi,
The stock check is done during the add to cart, the checkout, and when the order is created.
If the "Update stock when order is" setting of the HikaShop configuration is set to "confirmed", then the stock won't be reserved until the order is paid. So, this case can happen and we cant do anything about it in HikaShop. Suppose you have 2 users with the same product in the cart with a stock of 1. Both create their order and are redirected to the payment gateway at roughly the same time. Since you want the stock to be updated only after the payment, it is normal that this is allowed.
Once one user pays for his order on the payment gateway, his order is confirmed and the stock goes to 0. However, the other user is already on the payment gateway. And thus there is no way for HikaShop to prevent him from finishing his payment.
However, if you set the setting to "created", then the stock is reserved when the order is created, before the payment. And so this case can't happen. Once one user creates an order, the stock will be decremented, and if it goes to 0, then no other user will be able to create an order.
In such case however, you want to configure the HikaShop order auto cancel plugin so that created orders that have not been paid are automatically cancelled after a while in order to liberate the stock.