I've never kept food cold in 10 years of bringing my own. Sandwiches have been fine and the hot meal gets fully heated for 30 mins by the crew and has never made me ill. The only time food has made me sick on an aeroplane was about 20 years ago and that was airline-provided crew food.
If you're on the Airbus, you'll notice the ledge below the No. 3 window is icy to the touch, so I'd stow your sandwich (wrapped) on there. Just remember to move it if you're planning to slide open the DV window on the ground, otherwise the subsequent tech log entry becomes a difficult one to word.