Python with Mysql: Fetch the available resource from DB parallely

I have my resoruces stored in mysql DB:

eg :

|IPaddress | Status|
|10.x.x.x| yes|
|10.1.x.x| yes|
I am trying to get the available resource and after that will update DB with status No.

query = ("SELECT IPaddress from TABLE where status='yes'")
cursor = mydb.cursor()
cursor.execute(query)
result=cursor.fetchall()
query1 = ("update TABLE set Status = 'no' where IPaddress ='{}' ").format(result[0])
cursor.execute(query1)
mydb.commit()
But, my API will get called from multiple places simultaneously how i can ensure, the resource wont get allocate to different calls..