Non-Markovian optimal sideband cooling