Timing is dependant on your own personal sleep schedule. About an hour before bed you’ll want to eat carbs and proteins, preferably oatmeal and cottage cheese. Cottage cheese is casein protein which digests slower, oatmeal is a complex carbohydrate. A few hours into an 8 hour sleep schedule, you’re body starts catabolizing muscle for energy, those foods help delay it.
You never want to do both at the same time(which 99% of people do anyway), for that exact reason, regardless of the order, your body doesn’t have the energy stores left and your exercise stops being beneficial. It’s best to split them between seperate days(or seperate parts of the day).