At CAI or SPX, stay airside—CAI is congested and SPX connections are limited, so focus on food and rest.
A 3-6 hour layover to Cairo is challenging. Cairo International Airport is 22km from central Cairo and traffic can be severe. If you have e-Gate access and fast immigration, a Metro ride ($0.20) to downtown takes 30-40 minutes. The Egyptian Museum in Tahrir Square is the only realistic target for a short layover - allow 90 minutes inside. Head back 90 minutes before your flight. Total: only about 90 minutes of actual city time.
Six to ten hours is the minimum for a meaningful Cairo visit. Take the Metro to Tahrir Square and go straight to the Egyptian Museum - spend 2-3 hours and prioritize the Tutankhamun galleries and mummy room. Walk 15 minutes to Khan el-Khalili bazaar: the 14th-century trading streets are excellent for gold, spices, and traditional crafts. Stop at Fishawi's cafe, open continuously since 1773, for tea and shisha in a covered alley. Return via Metro - allow 90 minutes including re-entry into the airport. Avoid Friday afternoon traffic if at all possible.
With 10+ hours, add the Giza Pyramids to your itinerary. They are 25km southwest of downtown Cairo and take 45-60 minutes from the airport by rideshare ($15-20). The Sphinx is on the same site. Sunrise at the pyramids is extraordinary - if your layover allows a very early morning, this is the time to go. The Egyptian Museum merits a full half-day. Islamic Cairo (the medieval walled city east of downtown) contains the Al-Azhar Mosque, the Citadel, and the Khan el-Khalili bazaar in a walkable circuit. Eat ful medames for breakfast, koshari for lunch (cheap, filling, excellent), and grilled fish by the Nile for dinner.