UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'cvs85BT6sxU9o64wLc1ZuaVJM7zO0W1c0VfXThXE8aM=' 
WHERE 
  key_id = '51e44e73dbe63bd0f0e8f3872bc74de3c29aaee64c80c5b339610fc064384229' 
  AND (
    token = 'cvs85BT6sxU9o64wLc1ZuaVJM7zO0W1c0VfXThXE8aM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00047