How to write update all conditionally queries in rails4

I want rails queries similar to:

UPDATE users SET name="test" WHERE name="test1"

User.update_all({name: 'test'},{name: 'test1'}) # deprecated since Rails 4

or

User.where(name: 'test1').update_all(name: 'test')

User.where("name like 'test1'").update_all("name = 'test'")