UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Qa8X7EZjG5psFD3PPGs47QeH8bDBfTQMm7DHZCHFaAk=' 
WHERE 
  key_id = '5ab826ee0d1c860dd34de26d29b7391b03ee7547ca8a10a9e5e54d86779016e5' 
  AND (
    token = 'Qa8X7EZjG5psFD3PPGs47QeH8bDBfTQMm7DHZCHFaAk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036