Shelf life of apples in muffins
The long cooking and high heat from the oven will definitively kill most of the bacteria and inactivate some enzymes present in the apple such as the famous polyphenol oxidase
 responsible for the oxidation process that makes raw apples brown when sliced. 

However, this won't stop the apples (and of course the whole muffin) to spoil on the fridge over time. Moulded apple can be particularly bad because of patulin.