UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KwakbmGGO/+AIpVGDG7HX3nP8CYD/eRfHEK0DwCX7YU=' 
WHERE 
  key_id = 'c44450dde1c74d18f250268eceb93828d6489eef0672d18178250dac8eca9919' 
  AND (
    token = 'KwakbmGGO/+AIpVGDG7HX3nP8CYD/eRfHEK0DwCX7YU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045