You can change the middle part of your script like this:
if ! mkdir /tmp/aisync.lock 2>/dev/null; then
printf "Failed to aquire lock.
That way the error message from
mkdir will be thrown away.
At the same time the behavior is unchanged,
mkdir still fails,
so the condition in the
if will evaluate true and the script
will exit with 1.