Heavy compound lifts are a young and healthy man's game. Furthermore extended cardio sessions puts extended strain on ligaments/joints. I don't know what kind of time you have on your hands and how far your willing to go. But assuming you've got time and motivation I'd strip it down to a basic bodybuilding routine.
In the mornings go for a 30-45 minute walk at a moderate pace. Or try to cycle, again at a moderate pace nothing intense that would cause pain. In the afternoons/evenings hit the gym. For major muscle groups (Chest, back, legs, delts) do 16-24 working sets per week. For accessory groups (Abs/Bi's/Tri's/Traps/Calves/Forearms) 10-12 working sets per week. Stick to 10-12 rep ranges. Focus on a full range of motion and getting a good contraction in the target muscle group. You could either do: Chest/tri, back/bi, legs/abs, shoulders/traps. Or something like Chest, Back, Legs, Shoulders, Arms. (Depending if you want to lift 4 or 5 days per week).
Only do exercises that don't cause pain. Focus on proper contraction and over-all volume. Be consistent. Clean up your diet/nutrition and cut processed foods out. Try to time your rest periods and keep them at 30-60 seconds. If you need longer then that you need to lighten the weight your moving. Focus on your breakfast being a higher calorie meal. An hour before you lift get a good meal in with a lighter protein (Chicken, fish, etc.) and a quick digesting carb (White rice for example). After you lift (within the hour) try to eat again. Carbs & protein, perhaps a mirror of your pre-workout meal.
Your at an age where health and how you feel is the priority and then I'd say how you look (Because that can affect how you feel) comes next. Athletic performance, being really strong, etc. are all after all of those. In my 30s now and those are the principles I follow. I do one compound movement for each major body part with a barbell or DB (But still light because its 4 sets of 10 reps). Then everything is either lighter DB's, Cables, or machines at 12 reps. Feel great and in the best shape of my life. No nagging injuries/pains. Which I had when I focused on performance/strength training.
[/edit] If you have pain with squats and compound lifts don't do them. Machines will be fine. You can still progressive over-load over time.