UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'AWWVuKGq2+dqF5twSOm6rYgos4HIjozTcPdHNwR10VA=' 
WHERE 
  key_id = '10a1874f1f11af273186fc5b5af8785afbb1ae03605bdfb369ba966f756d1e14' 
  AND (
    token = 'AWWVuKGq2+dqF5twSOm6rYgos4HIjozTcPdHNwR10VA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00051