Sadly, the answer is… it depends.
If for some reason the casing was breached by rusting or impact damage and water was able to leak inside there is a high probability the explosive has been neutralized. But if the device was sealed properly by a competent manufacturer, as per the specifications there is no reason it cannot work 100+ years from now.
I personally have fired some 7.35×51 Curcano ammunition built in the late 1930s and it worked flawlessly even after 70 years. Of course it was stored in a dry area.
Fortunately most modern weaponry has an “expiration date” due to the intentional addition of some form of destabilizing element. But even that is on the order of 20 years.
In one of my chemistry classes we were asked to design an experimental process that would take basic gunpowder and break it down into its component parts using solution, precipitate, evaporation, etc.
I doubt that anyone on the plant has ever done it. It was way quicker and more fun to detonate.