Quick googling turned up lots of insane (or just outdated) type conversion advice, while the answer is very simple: use standard function to_timestamp(), like this:
INSERT INTO foo VALUES ( to_timestamp(1342986162) )
Reverse operation is equally easy:
SELECT EXTRACT( EPOCH FROM now() )
Hopefully next time when I forget how to do that, I’ll remember to look for it here.