I personally don't like nesting subqueries that much, but if you have to go with that, you can achieve your result by adding 'prodID <> 22' just before the LIMIT:
SELECT * FROM products WHERE prodID IN
(SELECT prodID FROM keywords WHERE attributeID IN
(SELECT attributeID FROM keywords a WHERE prodID = 22))
AND prodID <> 22 LIMIT 4;
If you're not bound to that, please notice that you can achieve better performance by using joins:
A LEFT [OUTER] JOIN can be faster than an equivalent subquery because the server might be able to optimize it better—a fact that is not specific to MySQL Server alone.
Prior to SQL-92, outer joins did not exist, so subqueries were the
only way to do certain things. Today, MySQL Server and many other
modern database systems offer a wide range of outer join types
.
You may want to look at these to improve your queries performance: https://dev.mysql.com/doc/refman/5.7/en/rewriting-subqueries.html