UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xN1NB9PxKc7m4Bj4BDWq+gwkRpQmcc9x3jEWZ1LhffU=' 
WHERE 
  key_id = '1b49aed3d027d1c359652fc4123e2ce64a5d0a87f40ef20622e70b87b773872b' 
  AND (
    token = 'xN1NB9PxKc7m4Bj4BDWq+gwkRpQmcc9x3jEWZ1LhffU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033