Advice for the oul' fellah
Hey old man! ;-)
From Northern Spain in four weeks? Yes! Two days for Spain top to bottom. Three days through Morocco, north to south. Mauritania to Dakar four days along the coast.
That's going flat out. No rests. No stops to savour where you're at.
But if you've got four weeks to go from Northern Spain to Dakar (I'm not talking about the return journey; only one-way) then you have plenty of time to cover the distance and enjoy some of the places you'll travel through.
You don't need carnet for Spain; I'm 99% sure you don't need it for Morocco; but I do think you need it for Mauritania and Senegal. Would be worth checking this. Perhaps phone the RAC?
Forget the weather. If you want to go, and you only have a particular window of opportunity, then just go. Sure, it might be hot. What were you expecting. It might not be the most comfortable in the height of summer, but it sure as hell won't stop you. It's not impossible. Just go!
P.S. 52? Sure, you're only a young lad! ;-)