it ran perfectly for about 3 hours then shut down by itself, every time i try to turn it on it cuts out instantly no error messages as no time to boot bios, tried removing ram ssd and hdd but still does same thing
asrock z68 extreme 4 gen3
intel i5 2500k
corsair vengance 8gb ram
corsair cx600 psu
corsair 400r case
Did you try to reseat CPU? I once had the similar (but not the same) problem. Every time the PC was powered on, it beeped and shut down. Then I removed CPU cooler, cleaned old thermal paste, reapplied new thermal paste, and reseated CPU, which solved the problem. BIOS showed there were "thermal events(?)", so I guess CPU heat was the issue. Not sure if you got the same one, but I think it's worth trying.
The other thing I would look at is your PSU. It sounds almost like there is a short...
I would take everything out of the case, put the motherboard on a *wood* table, and plug in only 1 stick of RAM, the GPU and a single hard drive. If you can get it to boot, keep adding parts until the whole system is assembled on the table.
Once everything is working there, it limits it to a short in the case. Make sure there are no additional metal parts touching the motherboard except for the posts that are supposed to be installed.
the computer was working for three hours before this happened and it was in the case so it shorting is highly unlikely, and iv tried clearing cmos using the button that asrock motherboard has to clear the cmos
Both of those are great ideas. Just curious as it may better help troubleshoot your problem, are you getting any sort of beeps from your motherboard? Assuming you have the speaker hooked up to allow beeps. If i had to guess with the information provided I would agree with these two fellas in CPU or PSU. It could be the motherboard as well, but I would think it would not even power up if the mobo was shorting or bad. Although from the article that toms had posted on PSU's, it sounds similar to a power issue. Power supply would be most likely place to start and cheapest.