UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'ui7EHnfkMAgCCVQcdteNAydlqx9O5du2FNLVDL0of8o=' 
WHERE 
  key_id = '8e1842f53945efd781f704a2bb0a94b39e30f1685b963ba41136e90673bfee65' 
  AND (
    token = 'ui7EHnfkMAgCCVQcdteNAydlqx9O5du2FNLVDL0of8o=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00042