UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vMVcUGspqRZo+FvXSe/FjiKFlhMWEF0ZxxtWgGsycro=' 
WHERE 
  key_id = '9646eb3224684cce28909adfea0789e7084717b7c87497c95a12dae570c48361' 
  AND (
    token = 'vMVcUGspqRZo+FvXSe/FjiKFlhMWEF0ZxxtWgGsycro=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00017