When the court determines on the written application of a prisoner that he or she has been imprisoned for 60 days solely for failure to pay a fine or costs which total not more than $300 and that the prisoner is indigent and unable to pay the fine or costs, the court shall order the prisoner discharged from custody.