Zend certified PHP/Magento developer

Error while saving Category in Magento 2.4.6-p1

When I try to save a category I am getting cloudflare timeout error and the category is not getting saved. When I checked the exception log I found this error : SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction, query was: UPDATE catalog_category_entity SET attribute_set_id = ?, parent_id = ?, created_at = ?, updated_at = ?, path = ?, position = ?, level = ?, children_count = ? WHERE (entity_id = '1337'). When I restart the mysql service and refresh the same page the category gets saved. How to fix this?