UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'pLKN9uI073ch85sogEfT4wYe2ucKFmZB+tgGOMtvNmE=' 
WHERE 
  key_id = 'a3ab0d3e3f16db2236fad3e39663d8e0ae0f36235c7f6225b42daaa3e1609dd2' 
  AND (
    token = 'pLKN9uI073ch85sogEfT4wYe2ucKFmZB+tgGOMtvNmE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00050