An other problem with this function is that it doesn't detect the other ways to write hexadecimal literals in mysql server. Reading documentation [1] we see other ways to do it:
SELECT X'4D7953514C'
SELECT x'0a'+0
Good luck
[1] https://dev.mysql.com/doc/refman/5.7/en/hexadecimal-literals.html