Increase key length check in replace token method