The 2 queries are quite different. You don't mention what $q starts out being, but let's say $q='abc'; Then you add a wild card to it, $q="abc%";
Prepare can be a very expensive critter and the DB might do a lot of thinking about what indicies, etc to use. In the first case, the DB knows that the string is going to start with "abc" at the time that the prepare method is called. That is a huge hint that it can take advantage of.
In the second case, the DB doesn't know that in key bit of info advance, so it is a lot more "stupid" about how it goes about the "execute" part. So the basic difference is that "more thinking" went into the first prepare vs the second prepare because the DB knew more about what you were going to do.