Presuming it's a factory headunit, then it sounds faulty. It's obviously not a 'feature' to do that; except the headunit may be set to turn off after 30 minutes of use (when the ignition is off), and the headunit may not be recognising that the ignition is on.
Presuming you have a facelift 156, then the headunit will be triggered on/off via CANBUS. Perhaps that trigger is failing, but it's not something you can easily test, cos it's a signal from the ECU. Again, more likely a faulty headunit.
You can pull it out to check that the plugs/wires are securely fitted, but you're unlikely to find an obvious fault.