Man sentenced to 40 years after prison escape