Bind or set case-fold-search to nil.
C-h k M-% tells us:
M-% runs the command query-replace (found in global-map), which is an
interactive compiled Lisp function in replace.el.
It is bound to M-%, <menu-bar> <edit> <replace> <query-replace>.
(query-replace FROM-STRING TO-STRING &optional DELIMITED START END BACKWARD REGION-NONCONTIGUOUS-P)
Probably introduced at or before Emacs version 1.3.
Replace some occurrences of FROM-STRING with TO-STRING.
As each match is found, the user must type a character saying
what to do with it. For directions, type C-h at that time.
...
Matching is independent of case if both case-fold-search
and search-upper-case are non-nil and FROM-STRING has no
uppercase letters; if search-upper-case is nil, then
whether matching ignores case depends on case-fold-search
regardless of whether there are uppercase letters in FROM-STRING.
Replacement transfers the case pattern of the old text to the
new text, if both case-fold-search and case-replace are
non-nil and FROM-STRING has no uppercase letters.
(Transferring the case pattern means that if the old text
matched is all caps, or capitalized, then its replacement is
respectively upcased or capitalized.)
If your string to replace had uppercase letters and you wanted to always respect case then you would set case-fold-search to non-nil and search-upper-case to nil. In your case the string to replace has no uppercase letters, so it's sufficient to set case-fold-search to non-nil.
You can customize either or both of these variables (options), to make them have the values you want most often by default. That way, you will only need to set or bind them occasionally, for your less frequent uses. To customize them, use M-x customize-option.