UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'OSwUXkeaYpGO1x56reB0sM/riCWnvt5lq+JWQNBER/E=' 
WHERE 
  key_id = 'f2e5a198cf1f3fff7551ff5f96db7d081d56afa3072f8e0435d2b43368cd7667' 
  AND (
    token = 'OSwUXkeaYpGO1x56reB0sM/riCWnvt5lq+JWQNBER/E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021