If you have any doubts, don't do any of this, just wait til the system is cool to the touch. Steam is extremely dangerous!
With that said, you can open the system a lot sooner than a matter of hours, and possibly much sooner than 30 minutes, if you need to. The easiest way to gauge if it's under sufficient pressure that you shouldn't open it is trying to squeeze the upper radiator hose. Get a feel for what squeezing it is like when it's cool, and compare when it's hot (using a cloth or insulated gloves since it's going to be unpleasant to touch with your hands). If you can compress it with your fingers, it's not under extreme pressure, but there could still be enough pressure to shoot out hot coolant/steam when you take off the cap.
Cooling can be accelerated by leaving the key in the on position with the engine off, on vehicles where that causes the fan to run. You can also start, quickly rev (to circulate the coolant via the water pump; 1-2 seconds is a plenty), and stop the engine a couple times while it's cooling to speed up the cooling process. In a real pinch you can spray/pour water on the radiator. Rapid cooling like that can lead to cracks, but the radiator itself should handle it fine because that's what happens in a heavy rain anyway. Doing the same on the engine is not a good idea.
Once you think it's cooled enough, cover the cap in large, thick towels, one of them laid out across the entire area around the cap and one or more folded in layers at the point of the cap itself, press down forcefully on it, and turn. Very gently reduce the force and listen for escaping steam/coolant. If you hear it, quickly apply more force and turn clockwise to close the cap again, or, if anything starts to feel hot or you feel like you can't get it back on due to the pressure, let go and back away from the vehicle fast. This makes more sense and is a lot easier if you've practiced it on a cool system beforehand.