MySQL - Deduct from two columns with a remainder
You can use the variables to do the trick:

UPDATE table AS w
  JOIN amounts AS z ON z.w_Id = w.ID
   SET w.balance = IF( (@remainder := w.balance - z.amount) &gt;= 0, @remainder, 0 )
     , w.otherBalance = IF( @remainder &gt;= 0, w.otherBalance, w.otherBalance + @remainder )
;  


Here I suppose that amount is fetched from the another table amounts and perform the mass update for all the rows at once.

If the amount is bigger than balance, then @remainder becomes negative therefore I've added it to the otherBalance instead of subtracting it.