UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VDRtedoNDBRblI/4UBvpT34mGwNvovIlPdqtXPbiaD8=' 
WHERE 
  key_id = '8f98305c1b20fa487275b5f9340e4e2bce98d48c51d85dea8dad311d2a7d084e' 
  AND (
    token = 'VDRtedoNDBRblI/4UBvpT34mGwNvovIlPdqtXPbiaD8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037