Leviticus 25:51-53
51 If many years remain, he must pay for his redemption a larger share of the price paid for him.
52 If only a few years remain until the Year of Jubilee, he is to compute that and pay for his redemption accordingly.
53 He is to be treated as a man hired from year to year; you must see to it that his owner does not rule over him ruthlessly.