Slow query with IN

Hi,

I have problem with query with IN option, is very slow or I have DEADLOCK.

The query is:
SELECT * FROM token WHERE id in
(SELECT token_id FROM tokeninfo WHERE Value = ‘546845’)
in this case or is very slow or I have “ERROR 1213 - Deadlock found when trying to get lock;”

If my query is "SELECT * FROM token WHERE id in (‘367’), it is very fast.

Where is the problem?

Regards,
Dario

The problem will be slow subselect

SELECT token_id FROM tokeninfo WHERE `Value` = '546845'

. Look if it is using any index by running EXPLAIN on that query. How many rows do you have in the table tokeninfo?