It wasn't lipsynched. If you watch it, you can hear her "ooow"'s and the track over it, she says it a millisecond before the track plays it. And uh, why would Pharrell lipsynch?

Oh, and at the beginning, the music is off a little. Aaaaaand Britney's "woo" at the beginning of the first chorus is obviously cut off; you can hear it, but not very well.