"At" might be the most difficult preposition. It has countless uses. Unlike most other prepositions (like "on", "under", "in", "outside",...) it has no obvious physical interpretation. In many ways, it acts more like an adjective than a preposition. It is similar to the adjective "near", but it is stronger, meaning "very, very, very near". Interestingly, "near" can function both as an adjective and a preposition, so the words are like cousins.
I use "at" in a manner similar to pointing my finger at something. Saying "at a pet store" is like pointing "at" a pet store, saying its name, giving its address, or showing it on a map. So, "at" is more general than "in" which actually places you inside of a building.
Your phrases work with either preposition.