How to get an element with attribute name and again set a new attribute to the same element?

How to get an element with attribute name and again set a new attribute to the same element, suppose I have an <a href="#" myOwnAttributeName="hello"></a>.

Now I know how to select this element using document.querySelectorAll('a[myOwnAttribute="#hello"]') I need to know how will I set an attribute to the selected element. My final tag should look like <a href="#" myOwnAttributeName="hello" class="class-hello"></a> here I need to add a class name.

Using the setAttribute doesn’t work.

document.querySelectorAll('a[myOwnAttribute="#hello"]')
<html>
<a href="#" myOwnAttribute="hello">Click me</a>
</html>