UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'zbniu3ib+lLaAMLUHrzjhR4JvdiriqCYqc+ds+8Pkks=' 
WHERE 
  key_id = '6fdd4d1e491d920e98b7ecf99b9e50789c38664f598fa9005aa1135dac14180d' 
  AND (
    token = 'zbniu3ib+lLaAMLUHrzjhR4JvdiriqCYqc+ds+8Pkks=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028