Is there any simple way to update a subset of dataframe rows using another one?

Practically, I want to use `R` to do `UPDATE x INNER JOIN y ON x.col1 = y.col1 SET x.col2 = y.col2`

Inputs:
=======

```
x <- data.frame(col1=c('a','c','b','d'), col2=c(11,34,13,25))

```

[![enter image description here](https://i.stack.imgur.com/xFBAU.png)](https://i.stack.imgur.com/xFBAU.png)

```
y <- data.frame(col1=c('a','b'), col2=c(3,5))

```

[![enter image description here](https://i.stack.imgur.com/DtSLH.png)](https://i.stack.imgur.com/DtSLH.png)

```
z <- match(x$col1,y$col1)

```

> 
> [1](https://i.stack.imgur.com/xFBAU.png) 1 NA 2 NA
> 
> 
> 

Outputs:
========

**Method 1**

```
x$col2 <- y$col2[z]

```

[![enter image description here](https://i.stack.imgur.com/zBi10.png)](https://i.stack.imgur.com/zBi10.png)

**Method 2**

```
x$col2[z] <- y$col2[z]

```

> 
> Error in x$col2[z] <- y$col2[z] : NAs are not allowed in
>  subscripted assignments
> 
> 
> 

**Method 3**

```
x$col2[z[!is.na(z)]] <- y$col2[z[!is.na(z)]]

```

[![enter image description here](https://i.stack.imgur.com/IXlOz.png)](https://i.stack.imgur.com/IXlOz.png)

Desired Output:
===============

in `x` update only the values that match in `col1` of `y` 

[![enter image description here](https://i.stack.imgur.com/Ns3Uk.png)](https://i.stack.imgur.com/Ns3Uk.png)