MSPs passed a law meaning those sentenced to under four years in prison will now be released after serving 40 per cent of their time behind bars.