First, rest assured that the Sun won't explode. Low mass stars like the Sun toss off their outer layers with little violence, leaving behind a white dwarf.
The quickest that news of anything happening on the Sun comes to us is at the speed of light, which takes about 8 minutes 20 seconds to reach the Earth. If we lived around a more massive star that was going to explode, we may get a little advanced warning (perhaps a couple of hours) from tiny particles called neutrinos before the flash and blast.