Google Sheets: one query for Sum and Filter?

If I have a sheet with data like this:

A    B
x    1
y    2
z    3
x    4

I can sum the values with

=query(A:B, "select A, sum(B) group by A")

How can I then filter this result? For example, in SQL to see x and y only (excluding z), I would add a WHERE clause like:

WHERE A IN ('x', 'y')

How can I get this functionality in a Sheets query?