Probably the key is to assume worst case scenario will always apply.
After all space is an hostile enviroment you cannot control, and you need to have the device working for at least the whole mission lifetime.
Another factor is that when NASA says the expected mission life is like 30 days or whatever, it doesn't mean they are designing to just meet that 30 day target. I can only speak to mechanical design, but the margins that NASA uses are huge, at least compared to consumer tech (I've worked in both). The 30 days is more like what they are "liable" for achieving per their directive. Liability isn't quite the right word, but the missions are pretty small in their official spec/definitions.