~ておけば ('if you leave X done, if you keep X done') is the conditional form of ~ておく ('do in advance / keep in a state'). 痛む ('to ache, hurt, spoil') has multiple meanings: physical pain, emotional pain, and — here — food spoilage (often written 傷む for the spoilage sense).