You do not have to consent to any police search. Law enforcement has the right to pat down your outer clothing if they have a reasonable suspicion that you may be armed and dangerous. For any other search, police need a warrant to search or probable cause to conduct a warrantless search.
If the police have a warrant, you must allow them to search, but you should not affirmatively or explicitly consent to the search. They can search without a warrant only if they have probable cause. To emphasize: never consent to any kind of search, regardless of what the police say to you. Allow them to search if they have a warrant, but do not give them your affirmative consent.