What aspect of this is important? Ie. Why isthe quantity of 2 important? Isn't the real issue to prevent a product from going into a back-order status?

Also, what do you want to happen to the product when it goes out-of-stock, should it remain visible to customers or become disabled/hidden?

Do you want this scenario to occur for only one product or all product in the store?