A window AC will serve you consistently well for eight to ten years on average. Depending on the build quality and maintenance frequency, it may last even longer.
On the other hand, a wall unit will last up to 10 years with proper care. This is easier said than done, though, since wall air conditioners require more maintenance than window ACs.