I think he had two options at $20 million each.
The options were held by the Sox. So, if he gets hurt this year or has a terrible year, then his net gain over 2 years at $45MM is more than the $5MM (because the Sox would have declined his option). So, still not a horrible deal. Plus, playing in LA is a cakewalk for him compared to the fish bowl existence in Boston.
That said, I glad he didn't get more after screwing the Sox.