Don't keep baking powder for more than one year, as it loses its potency. To check whether your baking powder is still usable, add 1 teaspoon of it to 1/3 cup of hot tap water. The mixture should bubble vigorously.
Arm and Hammer places the shelf life of their baking soda at 3 years. As a leavening agent, it might not be a good idea to use baking soda older than this. However, as a cleaning agent, I would not have any reservations about using baking soda that had been on the shelf for 50+ years.