UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'kjv8l56/ABvyn1hzGO7N28MJEpFRLim8fSn/9YI5uNM=' 
WHERE 
  key_id = '4bc59f9c07fc4de894253a86a316aa767758c265d9fa2379e58e4b818568d3bf' 
  AND (
    token = 'kjv8l56/ABvyn1hzGO7N28MJEpFRLim8fSn/9YI5uNM=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024