An Iranian dissident scholar who was sentenced to death two years ago for blasphemy has been handed a five-year jail term instead following a retrial.