If you have an ID establishing a relationship between X and Y then you would update where the IDS are the table row identifiers.

You could do UPDATE Y Set A = X.A WHERE Y.B = X.B, but Y.A will be updated everywhere X.B and Y.B are equal.

With a key you can identify which row is updated when X.B and Y.B are equal.
UPDATE Y Set A = X.A where Y.PKID(primary key id) = X.FKID(foreign key id). So even though X.B and Y.B have the same values in 100 rows, it only updates the row Y.PKID.