Photochemistry and lifetimes of interstellar molecules