UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'clqtYjQv2LuNdpu1muA/uRcYoTmgfImJsELKfcxW0ao=' 
WHERE 
  key_id = '23938f40efc7592eea401ebe7690e7d59f81159b6298bbb152b65d8e0972711d' 
  AND (
    token = 'clqtYjQv2LuNdpu1muA/uRcYoTmgfImJsELKfcxW0ao=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052