According to the Bible, when is it OK to beat your slaves?

As long as they live at least a day or two after the beating.

(Because a slave is the slave-owner's money.)
If a man smite his servant, or his maid, with a rod, and ... he continue a day or two, he shall not be punished: for he is his money. Exodus 21:20-21