UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '45vk2nKlVkucz8zmJK0nHvDfIB2MyAaYWNyOmOohmPE=' 
WHERE 
  key_id = '4081382d2b9c245c94860696bd479a763d9bb2c7b79558e756ac01819c91ab2d' 
  AND (
    token = '45vk2nKlVkucz8zmJK0nHvDfIB2MyAaYWNyOmOohmPE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035