The "30 Watts" number is assuming a heatsink with 0 C/W, in other words "perfect", with a perfect interface, and with the ambient at 25 C. That gives 4.17*30+25 = 150 C, which is pretty standard.
As soon as you stick a real heatsink on there, the maximum power comes down. Keep Tamb at 25 C, but put a 2 C/W heatsink on with a 1 C/W interface, and you get a total film to ambient thermal resistance of 7.17 C/W, which at 17.4 W brings you right back up to the 150 C limit.
In a real application, you need to take your maximum ambient temp, your actual heatsink thermal resistance, and your actual thermal interface, to estimate the maximum power you can dissipate while staying below 150 C.
P = (150 - Tamb) / (4.17 + Hr + Ir)
Where Hr is the heatsink thermal resistance and Ir is the interface thermal resistance