Expiration dates or ‘best by’ (aka shelf-life) for baking products, refers to the manufacturers’ recommended date for quality. This does not take into consideration the temperature or environment at which the product is stored.
Storage is a major factor affecting shelf-life.
If the product can be stored at room temperature, there is a wide range of possibilities including humidity levels. Cocoa, for example, if stored in an air-tight container in a dark area below 70˚F/21˚C, can keep for many years.
Unbleached flour and whole wheat flour can be stored at room temperature, but refrigerating or freezing the flour will extend the shelf-life considerably. (Unbleached flour will gradually loose its gluten forming potential, while whole wheat flour will develop rancidity on improper storage).
If the product requires refrigeration and your refrigerator is opened often or runs more on the upper side of the recommended temperature range, it will shorten the shelf life. Freezers also vary greatly in temperature. Butter, for example, keeps well past the expiration date in a freezer that is -5˚F/-20˚C.
Oxidation is yet another factor in shelf-life and can be retarded by vacuum sealing products such as chocolate.
Contamination is also a factor in shelf life. Corn syrup, for example, can ferment if one dips a finger or spoon into the container.
When it comes to shelf-life, use your best judgment and taste buds and if there are any concerns, contact the manufacturer.