Any person sentenced conditionally to pay a fine or to be imprisoned for a term shall be discharged at the expiration of the term, and may be discharged at any time on payment of the balance of the fine, after deducting $150 for each day such person has been imprisoned under the sentence.