UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'k4kYFHNdwapVZaYF5BTuIjC/sXipkXP/UrIbAEjjuP0=' 
WHERE 
  key_id = 'f7024d604904c2dc98ec138b41c60349f9c2db97dc27831debcea3755d61e354' 
  AND (
    token = 'k4kYFHNdwapVZaYF5BTuIjC/sXipkXP/UrIbAEjjuP0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039