UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '86Bkh2Y1oMAwo35UIy/C34vPiO8FE35cF3T652JvzPI=' 
WHERE 
  key_id = 'b366be80643173e8c5ebf6c468ac3b34fc7bf8ef34ce2249aa11cb66ffabedaa' 
  AND (
    token = '86Bkh2Y1oMAwo35UIy/C34vPiO8FE35cF3T652JvzPI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032