RENAME table if target table does not exist

I work with a legacy system and there are multiple batches that are executed after one another. In each of these batches there should be a rename of a table, although this rename should only happen once.

So, there could be:

RENAME TABLE oldName TO newName

in batch1 and batch2. However, in batch2 it would be best if this statement could just be ignored. Of course, it would be more clean to just memorize if the statement has been executed but this clean solution is near to impossible in the current code base.

So, I would like a MySQL solution that basically says: If table newName does not exist, then execute the rename command. Otherwise, do nothing and also do not send an error message.