I don't think there are some limition of the csv lookup. For you case, 400000 entry will be OK.
But, actually:
if a CSV plug-in is used, the entire CSV file and additional buffers are created in memory and can consume large memory sets.
In order to minimize the memory usage due to the CSV plug-in it would be recommended to migrate the data to a separate data source such as LDAP server or other DB environment.