I would suggest another way: if you plan MMM play - build in parallel 2 Engineering Bays, once both upgrades are started - build armory. You need both of these upgrades picked up to level 3 ASAP.
If you build only 1 EB and due to any reason didn't build another yet...
In game against Zerg: I would upgrade attack in 1st turn. The biggest danger for marines (and marauders probably too) are bannelings. Armor upgrade doesn't help against them.
In game against Protoss: if they have DT/Colossus/templars - armor upgrade doesn't help too - so do attack first. If they have zealot/stalkers/sentries - armor as important as attack. But still I would start from attack upgrade as marines under stim pack are very good for kiting.
In game against Terran: if you opponent play mech: tanks, Thors... armor doesn't help too. so again - start from attack upgrade. If they play MMM - armor and attack same in importance.
Here you could make a decision: don't upgrade armor at all. That would be wrong. Also in game versus Zerg: you are fighting not with bannelings only. You also need to survive some zerling waves, so don't neglect armor updages.
So for general game, I would make following summary:
- Start with attack upgrade and follow with armor;
- Try to do both upgrades in parallel.
Answer is simple and hard: ASAP (if you play MMM, as you mentioned) or never (if you play Mech).
In game against Zerg: usually, around 8-9 minutes Zerg build mutas. For sure, you need to scout that. Too often you don't have any chance to build engineer bay till this time. But around that time, once spire is scouted - build 2 EB right immediately and build 2 turrets in each mineral line... and start both upgrades.
As I replied to comment, it is worth to build 2 EB, save some gas in order to get both upgrades, but if (due to some reasons) planning to do 1 upgrade only and you detected mutas (and/or mass mutas) it could be worth to start with defense upgrade. Having +1 defense upgrade reduce mutas damage from 13 (9+3+1) to 10 (8+2+0) => +23.1%, but having +1 attack upgrade increase your rines attack from 5 to 6 => 16.7%
In game against Protoss: depends from opponent. If he going to some kind of gateway units/Immortals - upgrade you infantry asap. If he goes for Colossus - you could delay infantry a little to get some Vikings/Thors and concentrate on their upgrades in first turn.
In game against Terran: if you see StartPort with techlab - that means banshees probably with cloak. Then you need: 1) expand, 2) EB + turrets in mineral lines. If you see opponent plays MM/MMM too: do infantry upgrades ASAP, if he goes mech play - think how to counter and if you will go with infantry - do upgrades ASAP. If no - delay them.